package com.xltq.service.impl;

import com.xltq.dao.IProductDao;
import com.xltq.dao.impl.IProductDaoImpl;
import com.xltq.entity.PageBean;
import com.xltq.entity.Product;
import com.xltq.service.IProductService;


import java.sql.SQLException;
import java.util.List;

public class IProductServiceImpl implements IProductService {
    @Override
    public PageBean<Product> findPage(String tid, int page, int pageSize) throws Exception {
        IProductDao productDao = new IProductDaoImpl();
        long count = productDao.selectCountByTid(tid);//总条数

        List<Product> list = productDao.selectProductByPage(page, pageSize, tid);
        return new PageBean<Product>(list,page,pageSize,count);
    }
    @Override
    public Product findProductByid(String pid) throws Exception {
        IProductDao productDao = new IProductDaoImpl();
        return productDao.selectProductByid(pid);
    }
}
